<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% 
	String context = request.getContextPath(); 
%>
<html>
<head>
<title>系统用户</title>
<link rel="stylesheet" type="text/css" href="<%=context %>/Source/lib/ligerUI/skins/ligerui-icons.css" />
<link rel="stylesheet" type="text/css" href="<%=context %>/Source/lib/ligerUI/skins/Aqua/css/ligerui-all.css" />

</head>

<body style="padding: 0;overflow:hidden;">
<div id="layout1" style="margin: -1px">
    <div position="left" title="自定义执行用户" style="height: 99.8%;overflow-x:hidden;">
        <%-- 工具栏 --%>
        <div id="toolbar"></div>
        <div id="mainGrid" style="margin: -1px; min-width: 480px;"></div>
    </div>
</div>

</body>
<script src="<%=context %>/gooflow/jquery.min.js"></script>
<script src="<%=context %>/Source/lib/ligerUI/js/ligerui.all.js"></script>
<script type="text/javascript">
var path = '<%=context %>';
var _path = path+"/bap/user";
$(function () {
    $("#layout1").ligerLayout({ leftWidth: 450, allowLeftResize: false, allowLeftCollapse: true, rightWidth: 400, space: 2, heightDiff: -1 });
    $("#mainGrid").ligerGrid({
        columns: [
            { display: 'id', name: 'userId', hide: true, width: 60},
            { display: '帐号', name: 'account', align: 'center',width:150},
            { display: '名称', name: 'userName', align: 'center',width:150},
            { display: '类型', name: 'userType', align: 'center',width:60, render: function (row) {return 'employee' == row['userType'] ? '内部员工' : '合作伙伴'}},
        ], sortName:"account", sortOrder:"asc", url: _path + "/list/json?rnd=" + Math.random(),
        width: 320, height: '100%', heightDiff: -1,checkbox:true
    });
    toolbar();
});
function toolbar() {
    var items = [];
    items.push({type: 'text', text: "&nbsp;&nbsp;&nbsp;<input type='text' id='search_account_like' name='search_account_like' />"});
    items.push({type: 'button', text: "查 询", icon: 'search', click: function () { f_doSearch(); }});
    $("#toolbar").ligerToolBar({
        items: items
    });
    $("#mainGrid").ligerGetGridManager()._onResize();
}
//enter事件
$(document).keydown(function (e) {
    if (e.keyCode == 13) {
        f_doSearch();
    }
});
//查询
function f_doSearch() {
    var manager = $("#mainGrid").ligerGetGridManager();
    manager.set('parms', {search_account_like: $("#search_account_like").val()});
    manager.loadData();
}
function f_load() {
    $("#mainGrid").ligerGetGridManager().loadData(true);
}
/*
 * 确定选择用户，并组装数据
 * */
function f_userJson(){
    var manager = $("#mainGrid").ligerGetGridManager();
    var rows = manager.getCheckedRows();
    var users = [];
    if (rows && rows.length > 0) {
        $(rows).each(function () {
            var hostJson = {id:this.userId,account:this.account,userName:this.userName,userType:this.userType}
            users.push(hostJson);
        });
    }
    return users;
}
</script>
</html>
